﻿
namespace SuperGo.SilverlightLib {
    public class Player {
        public static readonly Player White = new Player(1, "White", StoneState.White);
        public static readonly Player Black = new Player(2, "Black", StoneState.Black);

        private readonly int _id;
        private readonly string _name;
        private readonly StoneState _stoneState;

        private Player(int id, string name, StoneState stoneState) {
            _id = id;
            _name = name;
            _stoneState = stoneState;
        }

        public int Id {
            get { return _id; }
        }

        public string Name {
            get { return _name; }
        }

        public StoneState ToStoneState() {
            return _stoneState;
        }

        public override bool Equals(object obj) {
            if (obj is Player) {
                return ((Player)obj).Id == Id;
            }
            return base.Equals(obj);
        }

        public override int GetHashCode() {
            return Id;
        }
    }
}
